@(currentPage : Page[Product])

@****************************************
* Helper generating navigation links    *
****************************************@
@link(newPage:Int) = @{
    
   //var sortBy = currentSortBy
    //var order = currentOrder
    
    /*if(newSortBy != null) {
        sortBy = newSortBy
        if(currentSortBy == newSortBy) {
            if(currentOrder == "asc") {
                order = "desc"
            } else {
                order = "asc"
            }*/
       /* } else {
            order = "asc"
         }*/
  //  }
    
    // Generate the link
    routes.Application.home(newPage)    
}

@**********************************
* Helper generating table headers *
***********************************@

 @if(currentPage.getTotalRowCount == 0) {
        
        <div class="well">
            <em>Nothing to display</em>
        </div>
        
    } else {
	<fieldset>
	@for(prod <- currentPage.getList){	
		<div class="column" style="width:350px; margin:0 auto; padding: 7px; ;">
			<h5>@prod.getName()</h5>
			<div  style="height:254px;">
				<a href='/product/info/@prod.getId()'>
					<img class="img-responsive" src="@routes.Assets.at("images/product/")@prod.getPhoto()"/>
				</a>
			</div>
				
			<hr />
			<p>Price: @prod.getPrice() HUF </p><br />
			<p>Description: <a href='/product/info/@prod.getId()'>Details-></a></p>
			<!--<a href="javascript:history.go(-1)"><-back</a>-->
		</div>
	}
	</fieldset>
	<div align="center">
				<div id="pagination" class="pagination">
            <ul>
                @if(currentPage.hasPrev) {
                    <li class="prev">
                        <a href="@link(currentPage.getPageIndex - 1)">&larr; Previous</a>
                    </li>
                } else {
                    <li class="prev disabled">
                        <a>&larr; Previous</a>
                    </li>
                }
                <li class="current">
                    <a>Displaying @currentPage.getDisplayXtoYofZ(" to "," of ")</a>
                </li>
                @if(currentPage.hasNext) {
                    <li class="next">
                        <a href="@link(currentPage.getPageIndex + 1)">Next &rarr;</a>
                    </li>
                } else {
                    <li class="next disabled">
                        <a>Next &rarr;</a>
                    </li>
                }
            </ul>
        </div>
	</div>
}